Fix unlikely core dump in init_tty, and simplify terminfo case.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Aug 2013 18:10:30 +0000 (11:10 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Aug 2013 18:10:30 +0000 (11:10 -0700)
commitdb587009621de0f356df04e022bff5ee68e1d44c
treea0d4c1cfc036e5118fb0dd1eab196a7363bb9b07
parent8a55de36fdb85040f0d7cf6035f0feeddfbf5b60
Fix unlikely core dump in init_tty, and simplify terminfo case.

* term.c (init_tty) [TERMINFO]: Fix check for buffer overrun.
The old version incorrectly dumped core if malloc returned a
buffer containing only non-NUL bytes.
(init_tty): Do not allocate or free termcap buffers; the
struct does that for us now.
* termchar.h (TERMCAP_BUFFER_SIZE) [!TERMINFO]: New constant.
(struct tty_display_info): Define members termcap_term_buffer and
termcap_strings_buffer only if !TERMINFO, since terminfo doesn't
use them.  Allocate them directly in struct rather than indirectly
via a pointer, to simplify init_tty.
src/ChangeLog
src/term.c
src/termchar.h